function getGzClass(gz) {
  switch (gz) {
    case "亥":
      return "txt_shui";
    case "子":
      return "txt_shui";
    case "丑":
      return "txt_tu";
    case "寅":
      return "txt_mu";
    case "卯":
      return "txt_mu";
    case "辰":
      return "txt_tu";
    case "巳":
      return "txt_huo";
    case "午":
      return "txt_huo";
    case "未":
      return "txt_tu";
    case "申":
      return "txt_jin";
    case "酉":
      return "txt_jin";
    case "戌":
      return "txt_tu";
    case "甲":
      return "txt_mu";
    case "乙":
      return "txt_mu";
    case "丙":
      return "txt_huo";
    case "丁":
      return "txt_huo";
    case "戊":
      return "txt_tu";
    case "己":
      return "txt_tu";
    case "庚":
      return "txt_jin";
    case "辛":
      return "txt_jin";
    case "壬":
      return "txt_shui";
    case "癸":
      return "txt_shui";
    default:
      return "";
  }
}
function getGzcsty(ganZhi) {
  // 五行颜色映射
  const colors = {
    jin: "#ffaa33",
    mu: "#03ff0c",
    shui: "#0088ff",
    huo: "red",
    tu: "#806246",
  };

  // 通过switch判断天干地支对应的五行
  switch (ganZhi) {
    // 天干 - 木
    case "甲":
    case "乙":
      return { color: colors.mu };

    // 天干 - 火
    case "丙":
    case "丁":
      return { color: colors.huo };

    // 天干 - 土
    case "戊":
    case "己":
      return { color: colors.tu };

    // 天干 - 金
    case "庚":
    case "辛":
      return { color: colors.jin };

    // 天干 - 水
    case "壬":
    case "癸":
      return { color: colors.shui };

    // 地支 - 水
    case "子":
    case "亥":
      return { color: colors.shui };

    // 地支 - 木
    case "寅":
    case "卯":
      return { color: colors.mu };

    // 地支 - 火
    case "巳":
    case "午":
      return { color: colors.huo };

    // 地支 - 金
    case "申":
    case "酉":
      return { color: colors.jin };

    // 地支 - 土
    case "丑":
    case "辰":
    case "未":
    case "戌":
      return { color: colors.tu };

    // 非天干地支，返回空对象（不设置样式）
    default:
      return {};
  }
}
function getKongwangbg(iskw) {
  if (iskw == true) {
    return {
      backgroundColor: "#607D8B",
      borderRadius: "2rem",
    };
  } else {
    return {};
  }
}
function getLuokongbg(islk) {
  if (islk == true) {
    return {
      backgroundColor: "#E0E0E0",
    };
  } else {
    return{};
  }
}
function getBackgroundColor(index) {
  let colors = [
    "#73524b",
    "#6e4d53",
    "#634a5b",
    "#53495f",
    "#40495e",
    "#2f4858",
    "#74734d",
    "#658561",
    "#4d9683",
    "#33a4ae",
    "#a8847c",
    "#ffe5da",
    "#ffbce0",
    "#c34f75",
  ];
  // 使用取余运算实现循环
  const colorIndex = index % colors.length;
  return {
    backgroundColor: colors[colorIndex],
  };
}

const goVirtualRoute = (go) => {
  if (go == true) {
    this.$router.push({
      path: this.$route.path,
      query: { ...this.$route.query }, // 保留原有查询参数
      hash: "#vt", // 添加固定锚点 '#vt'
    });
    alert("添加虚拟锚点");
  } else {
    window.history.back();
  }
};
export {
  getLuokongbg,
  getGzClass,
  getBackgroundColor,
  goVirtualRoute,
  getGzcsty,
  getKongwangbg,
};
